﻿
@*加入下面一句，下面的asp-controller、asp-action才起作用*@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"]</title>

    <link rel="stylesheet" href="~/lib/bootstrap.v4/css/bootstrap.min.css" />
    <script src="~/lib/bootstrap.v4/js/jquery.min.js"></script>
    <script src="~/lib/bootstrap.v4/js/popper.min.js"></script>
    <script src="~/lib/bootstrap.v4/js/bootstrap.min.js"></script>

</head>
<body>
    <nav class="navbar navbar-expand-md bg-dark navbar-dark">
        <div class="container">
            <a class="navbar-brand" asp-controller="Home" asp-action="index" style="color:white">MyAdmin</a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="Home" asp-action="index">首页</a>
                    </li>
                    <li class="nav-item">
                        <!-- asp-controller、asp-action是asp.net core下的写法，更加优雅，可读性更强 -->
                        <a class="nav-link" asp-controller="article" asp-action="index">我的博客</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="article" asp-action="post">发布博客</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="article" asp-action="Import">导入博客</a>
                    </li>
                </ul>

                @if (User.Identity.IsAuthenticated)
                {
                    <span class="navbar-text" style="margin-left:10%">
                        <a class="nav-link">您好，@User.Identity.Name ！</a>
                    </span>
                    <span class="navbar-text">
                        <a class="nav-link" asp-controller="account" asp-action="logOff">退出</a>
                    </span>
                }
                else
                {
                    <span class="navbar-text" style="margin-left:10%">
                        <a class="nav-link" asp-controller="account" asp-action="login">登录</a>
                    </span>
                }

            </div>
        </div>
    </nav>

    <div class="container" style="margin-top:10px">
        @RenderBody()
    </div>
</body>
</html>
